﻿<Window x:Class="DBSearch.DbSearcherMainWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:Toolkit="clr-namespace:Microsoft.Windows.Controls;assembly=WPFToolkit"
        xmlns:local="clr-namespace:DBSearch"
        Title="DB-Searcher" Height="600" Width="800" Loaded="Window_Loaded">
    <Window.Resources>
        <DataTemplate x:Key="DataTypes">
            <TextBlock Text="{Binding Path=TypeName}"/>
        </DataTemplate>
        <DataTemplate x:Key="ResultTables">
            <TextBlock Text="{Binding Path=TableName}"/>
        </DataTemplate>
        <local:DataTypeTemplateSelector x:Key="DataTypeTemplateSelector"/>
    </Window.Resources>
    <Grid>
        <Grid.ColumnDefinitions>
            <ColumnDefinition Width="125" />
            <ColumnDefinition Width="178*" />
            <ColumnDefinition Width="245*" />
        </Grid.ColumnDefinitions>
        <Grid.RowDefinitions>
            <RowDefinition Height="50" />
            <RowDefinition Height="30*" />
            <RowDefinition Height="30" />
            <RowDefinition Height="40*" />
            <RowDefinition Height="30" />
            <RowDefinition Height="30" />
            <RowDefinition Height="185*" />
        </Grid.RowDefinitions>
        <TextBlock Text="Database Value Searcher" Grid.ColumnSpan="3" FontSize="32" FontStyle="Italic" FontFamily="Calibri" TextAlignment="Center" Margin="0,8"/>
        <Label Margin="8,0" VerticalContentAlignment="Center" Grid.Row="1" Content="Connection String"/>
        <TextBox Margin="8,4" x:Name="ConnectionString" Grid.Column="1" Grid.ColumnSpan="2" Grid.Row="1" />
        <Label Margin="8,0" Grid.Row="2" VerticalContentAlignment="Center" Content="Data Provider"/>
        <ComboBox Margin="8,0" x:Name="DbProvider" Grid.Column="1" Grid.Row="2" Height="22" />
       
        <Button Margin="8,0" x:Name="Connect" Click="ConnectGetTypes_Click" Grid.Column="2" Grid.Row="2" Height="22" Content="Connect and get Types"/>
        <Label Margin="8,0" Grid.Row="3" VerticalContentAlignment="Center" Content="Search Criteria"/>
        <TextBox Margin="8,8,98,8" x:Name="SearchCriteria" Grid.Column="1" Grid.ColumnSpan="2" Grid.Row="3" TextWrapping="Wrap" />
        <CheckBox HorizontalAlignment="Right" Margin="8,0" x:Name="LikeSearch" Width="80" Grid.Column="2" Grid.Row="3" VerticalAlignment="Center" Height="15" VerticalContentAlignment="Center" Content="Like Search"/>
        <Label Margin="8,0" Grid.Row="4" VerticalContentAlignment="Center" Content="Column Type"/>
        <ComboBox Margin="8,4,60,4" x:Name="ColumnType" ItemsSource="{Binding}" ItemTemplateSelector="{StaticResource DataTypeTemplateSelector}" Grid.Column="1" Grid.Row="4"/>
        <CheckBox Margin="0,7.02,8,7.98" Name="DotNetTypes" VerticalContentAlignment="Center" HorizontalAlignment="Right" Width="42" Grid.Row="4" Grid.Column="1" Unchecked="DotNetTypes_Checked" Checked="DotNetTypes_Checked">.NET</CheckBox>
        <Button Margin="8,0" x:Name="Search" Click="Search_Click" Grid.Column="2" Grid.Row="4" Height="22" VerticalAlignment="Center" Content="Search"/>
        <Label Grid.Row="5" Margin="8,0" VerticalContentAlignment="Center" Content="Table Results"/>
       
        <ComboBox x:Name="TableResult" ItemsSource="{Binding}" ItemTemplate="{StaticResource ResultTables}" SelectionChanged="TableResult_SelectionChanged" Grid.Row="5" VerticalContentAlignment="Center" Margin="8,4.217" Grid.Column="1" Grid.ColumnSpan="2" />
        <Toolkit:DataGrid AutoGenerateColumns="True" Margin="8,12,8,29" x:Name="Results" ItemsSource="{Binding}" Background="#FFF0F0F0" Grid.Row="6" Grid.ColumnSpan="3" HeadersVisibility="Column" VerticalGridLinesBrush="#FF8C8C8C" HorizontalGridLinesBrush="#FF8C8C8C" AlternatingRowBackground="#FFC5D2E8" Foreground="#FF060A14" RowBackground="White" BorderBrush="#FF6E91B3" />
        <StatusBar Grid.ColumnSpan="3" Grid.Row="6" Height="23" Padding="0" Name="StatusBar" VerticalAlignment="Bottom">
            <StackPanel Orientation="Horizontal" Margin="5,0">
                <ProgressBar Name="ProgressRunning" Width="100" Height="10" IsIndeterminate="False"/>
                <Label Name="ProcessState" Width="Auto" Content="" Padding="0" Margin="5,0"/>
                <Label Name="RequiredTime" Width="Auto" Content="" Padding="0" Margin="5,0"/>
            </StackPanel>
        </StatusBar>
    </Grid>
</Window>
